﻿@inject IStringLocalizer<BarcodeReaderImage> Localizer

<BarcodeReader ScanType="@ScanType.Image" OnResult="@OnImageResult" OnError="@OnImageError" />
<BlockLogger @ref="Trace2" class="mt-3" />

@code {
    [NotNull]
    private BlockLogger? Trace2 { get; set; }

    private Task OnImageResult(string barcode)
    {
        Trace2.Log($"{Localizer["ScanCodeLog"]} {barcode}");
        return Task.CompletedTask;
    }

    private Task OnImageError(string err)
    {
        Trace2.Log($"{Localizer["ErrorLog"]} {err}");
        return Task.CompletedTask;
    }
}
